import request from '@/utils/request'

// 封装获取员工列表API
export const getEmployeeListAPI = (params) => {
  return request({ url: '/sys/user', params })
}
// 封装excel导出员工列表API
export const exportEmployeeListAPI = () => {
  return request({ url: '/sys/user/export', responseType: 'blob' })
}
// 封装excel导出员工模板API
export const getEmployeeTemplateAPI = () => {
  return request({ url: '/sys/user/import/template', responseType: 'blob' })
}
// 封装批量导入员工API
export const postEmployeeAPI = (data) => {
  return request({ url: '/sys/user/import', method: 'post', data })
}

// 封装添加员工API
export const addEmployeeAPI = (data) => {
  return request({ url: '/sys/user', method: 'post', data })
}
// 封装删除员工API
export const delEmployeeAPI = (id) => {
  return request({ url: `/sys/user/${id}`, method: 'delete' })
}
// 封装查找员工详情API
export const getEmployeeParticularsAPI = (id) => {
  return request({ url: `/sys/user/${id}` })
}
// 封装编辑员工API
export const editEmployeeAPI = (data) => {
  return request({ url: `/sys/user/${data.id}`, method: 'put', data })
}
// 封装获取已启用的角色列表API
export const enableEmployeeListAPI = () => {
  return request({
    url: '/sys/role/list/enabled'
  })
}
// 封装分配员工角色API
export const allotRoleAPI = (data) => {
  return request({
    method: 'put',
    url: '/sys/user/assignRoles',
    data
  })
}

